home *** CD-ROM | disk | FTP | other *** search
-
-
-
- aaaaffffSSSSeeeettttCCCChhhhaaaannnnnnnneeeellllMMMMaaaattttrrrriiiixxxx((((3333ddddmmmm)))) aaaaffffSSSSeeeettttCCCChhhhaaaannnnnnnneeeellllMMMMaaaattttrrrriiiixxxx((((3333ddddmmmm))))
-
-
-
- NNNNAAAAMMMMEEEE
- afSetChannelMatrix - set the channel mix matrix associated with a given
- track in an AAAAFFFFffffiiiilllleeeehhhhaaaannnnddddlllleeee
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////aaaauuuuddddiiiiooooffffiiiilllleeee....hhhh>>>>
-
- iiiinnnntttt aaaaffffSSSSeeeettttCCCChhhhaaaannnnnnnneeeellllMMMMaaaattttrrrriiiixxxx((((AAAAFFFFffffiiiilllleeeehhhhaaaannnnddddlllleeee ffffiiiilllleeee,,,, iiiinnnntttt ttttrrrraaaacccckkkk,,,, ddddoooouuuubbbblllleeee**** mmmmaaaattttrrrriiiixxxx))))
-
- PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRR
- _f_i_l_e is an AAAAFFFFffffiiiilllleeeehhhhaaaannnnddddlllleeee structure, previously created by a call to
- aaaaffffOOOOppppeeeennnnFFFFiiiilllleeee(3dm) or its equivalent.
-
- _t_r_a_c_k is an integer which identifies an audio track in _h_a_n_d_l_e.
-
- Since all currently supported file formats contain only one
- audio track, the value AAAAFFFF____DDDDEEEEFFFFAAAAUUUULLLLTTTT____TTTTRRRRAAAACCCCKKKK should always be used
- here for now.
-
- _m_a_t_r_i_x is an array of double precision floating point values which
- specify the manner in which a channel conversion operation
- should take place. Because the values in this array will be
- copied into internal memory, _m_a_t_r_i_x may be either a locally
- declared array or a dynamically allocated one, and in the latter
- case may be freed immediately after the function call.
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- aaaaffffSSSSeeeettttCCCChhhhaaaannnnnnnneeeellllMMMMaaaattttrrrriiiixxxx(((()))) allows an application to specify the exact file to
- virtual mapping, i.e., how nnnn audio file channels should be mapped into mmmm
- buffer channels. The matrix should be declared as a single-dimension
- array, but should be laid out as if it were a two-dimensional array with
- rows equal to virtual channels and columns equal to file channels. Note
- that this means that for any given channel conversion, i.e., 2 -> 4, 4 ->
- 1, etc., the matrix must be swapped rows-for-columns if you call
- aaaaffffWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss(3dm) instead of aaaaffffRRRReeeeaaaaddddFFFFrrrraaaammmmeeeessss(3dm) because the virtual
- format becomes the input rather than the output of the process.
-
- A channel conversion operation will occur any time nnnn != mmmm. This will
- happen during calls to aaaaffffRRRReeeeaaaaddddFFFFrrrraaaammmmeeeessss(3dm) or aaaaffffWWWWrrrriiiitttteeeeFFFFrrrraaaammmmeeeessss(3dm) when the
- _v_i_r_t_u_a_l channel count has been set to a different value than the _t_r_a_c_k
- channel count (they will always default to the same value). No matrix
- operation will occur if nnnn == mmmm even if a matrix has been specified.
-
- If no call to aaaaffffSSSSeeeettttCCCChhhhaaaannnnnnnneeeellllMMMMaaaattttrrrriiiixxxx(((()))) is made, or if it is called with
- _m_a_t_r_i_x set to NULL, the AF will revert to a set of default matrices.
- These were designed to match the default matrices used by the Audio
- Library (see AAAALLLLiiiinnnnttttrrrroooo(3dm)).
-
- aaaaffffSSSSeeeettttCCCChhhhaaaannnnnnnneeeellllMMMMaaaattttrrrriiiixxxx(((()))) must be called _a_f_t_e_r the call to
- aaaaffffSSSSeeeettttVVVViiiirrrrttttuuuuaaaallllCCCChhhhaaaannnnnnnneeeellllssss(3dm). Otherwise, a subsequent call to
- aaaaffffSSSSeeeettttVVVViiiirrrrttttuuuuaaaallllCCCChhhhaaaannnnnnnneeeellllssss will cause the matrix be reset to NULL.
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- aaaaffffSSSSeeeettttCCCChhhhaaaannnnnnnneeeellllMMMMaaaattttrrrriiiixxxx((((3333ddddmmmm)))) aaaaffffSSSSeeeettttCCCChhhhaaaannnnnnnneeeellllMMMMaaaattttrrrriiiixxxx((((3333ddddmmmm))))
-
-
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEE
- To pan a monaural audio signal buffer to the center of a stereo output
- file:
-
- double matrix[] = { .71, .71 } /* "equal power" stereo */
- int bufferChannels = 1; /* virtual (buffer) format */
- AFfilesetup setup = afNewFileSetup();
- AFfilehandle handle;
- /* initialize file channel count to stereo */
- afInitChannels(setup, AF_DEFAULT_TRACK, 2);
- handle = afOpenFile("mysoundfile.aiff", "w", setup);
- afSetVirtualChannels(handle, AF_DEFAULT_TRACK, bufferChannels);
- afSetChannelMatrix(handle, AF_DEFAULT_TRACK, matrix);
- /* note that
- afWriteFrames(...);
-
- To read a four-channel file into a stereo buffer with the front channels
- mixed into the far left and right and the back channels mixed into the
- near left and right:
-
- double matrix[] = {
-
- /* inputs */
- /* FL FR BL BR */
- /* outputs */
- 1.0, 0.0, 0.6, 0.4 /* L */
- 0.0, 1.0, 0.4, 0.6 /* R */
-
- };
- AFfilehandle handle;
- int bufferChannels = 2; /* virtual (buffer) format */
- /* open 4-channel sound file */
- handle = afOpenFile("4channelsound.aiff", "r", NULL);
- afSetVirtualChannels(handle, AF_DEFAULT_TRACK, bufferChannels);
- afSetChannelMatrix(handle, AF_DEFAULT_TRACK, matrix);
- afReadFrames(...);
-
- To write a four-channel buffer into a stereo file with the same mixdown:
-
- double matrix[] = {
-
- /* outputs */
- /* L R */
- /* inputs */
- 1.0, 0.0, /* L */
- 0.0, 1.0, /* R */
- 0.6, 0.4 /* BL */
- 0.4, 0.6 /* BR */
-
- };
- int bufferChannels = 4; /* virtual (buffer) format */
- AFfilesetup setup = afNewFileSetup();
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- aaaaffffSSSSeeeettttCCCChhhhaaaannnnnnnneeeellllMMMMaaaattttrrrriiiixxxx((((3333ddddmmmm)))) aaaaffffSSSSeeeettttCCCChhhhaaaannnnnnnneeeellllMMMMaaaattttrrrriiiixxxx((((3333ddddmmmm))))
-
-
-
- AFfilehandle handle;
- /* initialize file channel count to stereo */
- afInitChannels(setup, AF_DEFAULT_TRACK, 2);
- handle = afOpenFile("stereosound.aiff", "w", setup);
- afSetVirtualChannels(handle, AF_DEFAULT_TRACK, bufferChannels);
- afSetChannelMatrix(handle, AF_DEFAULT_TRACK, matrix);
- afWriteFrames(...);
-
- Note that the AF always assumes the 4-channel input has its channels laid
- out:
-
- Front
- 0 1
-
-
- 2 3
- Back
-
- CCCCAAAAVVVVEEEEAAAATTTTSSSS
- The Audio File Library has no way to check the size of the double* array
- passed in to aaaaffffSSSSeeeettttCCCChhhhaaaannnnnnnneeeellllMMMMaaaattttrrrriiiixxxx(((()))). Care must be taken to assure that the
- array has (in_channels * out_channels) elements, regardless of how the
- data in these channels is to be treated. Also note the above paragraph
- concerning the calling order of this function.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- afSetVirtualChannels(3dm), afGetVirtualChannels(3dm), afReadFrames(3dm),
- afWriteFrames(3dm)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-